<include file="public/head"/>
<include file="public/scripts"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>
<body>
<div class="wrap js-check-wrap">
    <!--<ul class="nav nav-tabs">-->
        <!--<li><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/index')}">微信公众号信息</a></li>-->
        <!--<li class="active"><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/reply')}">公众号管理</a></li>-->
    <!--</ul>-->
    <!--<br>-->
    <!--<ul class="nav nav-tabs">-->
        <!--<li><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/reply')}">回复消息</a></li>-->
        <!--<li <if condition="!isset($name)">class="active"</if> ><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/menu')}?id=0">自定义菜单</a></li>-->
        <!--<li <if condition="isset($name)">class="active"</if>><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/menu_list')}">个性义菜单</a></li>-->
    <!--</ul>-->
    <!--<br>-->

    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:;">自定义菜单列表</a></li>
        <li><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/add_menu')}?g_id={$g_id}">添加菜单栏</a></li>
        <if condition = "$g_id eq 0">
            <li><a href="javascript:void(0);" lid="0" onclick="updat_menu($(this));">发布菜单栏</a></li>
        </if>
        <if condition="!isset($name)"><li><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/online_menu')}">线上菜单栏</a></li></if>
    </ul>
    <script>
        function updat_menu(a){
            var id = $(a).attr('lid');
            $.ajax({
                type:'post',
                url: "{:cmf_plugin_url('QbtWxOs://AdminIndex/gx_menu')}",
                async: false,
                data: {'id':id},
                dataType: "json",
                success: function (data) {
                    if(data == 0){
                        layer.msg('无数据');
                    }else if(data == 1){
                        layer.msg('更新成功！');
                    }
                }
            })
        }
    </script>

    <form class="js-ajax-form" action="" method="post">
        <br>
        <if condition="isset($name)">
            当前操作个性菜单：<font color="red">{$name}</font>
        </if>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <td>编号</td>
                <td>菜单名称</td>
                <td>菜单等级</td>
                <td>菜单类型</td>
                <td>添加时间</td>
                <td>操作</td>
            </tr>
            </thead>
            <foreach name="p_list" item="vo">
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.menu_name}</td>
                    <td><font color="red">一级</font></td>
                    <td><if condition="$vo.name_type eq 1">点击事件 <else />跳转事件</if></td>
                    <td>{$vo.add_time|date='Y-m-d H:i:s',###}</td>
                    <td>
                        <a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/edit_menu?id='.$vo.id)}">{:lang('EDIT')}</a>
                        <a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/del_menu?id='.$vo.id)}" class="js-ajax-delete">{:lang('DELETE')}</a>
                    </td>
                </tr>
                <foreach name="list" item="fl">
                    <if condition="$vo.id eq $fl.p_id">
                        <tr>
                            <td>{$fl.id}</td>
                            <td>&nbsp;&nbsp;&nbsp;&nbsp;└─{$fl.menu_name}</td>
                            <td>&nbsp;&nbsp;&nbsp;&nbsp;└─二级</td>
                            <td><if condition="$fl.name_type eq 1">点击事件 <else />跳转事件</if></td>
                            <td>{$fl.add_time|date='Y-m-d H:i:s',###}</td>
                            <td>
                                <a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/edit_menu?id='.$fl.id)}">{:lang('EDIT')}</a>
                                <a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/del_menu?id='.$fl.id)}" class="js-ajax-delete">{:lang('DELETE')}</a>
                            </td>
                        </tr>
                    </if>
                </foreach>

            </foreach>
        </table>

        <ul class="pagination">{$page|default=''}</ul>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
</body>
</html>
